home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / util4 / noiz.lha / noiz_orig.doc < prev    next >
Text File  |  1996-01-26  |  10KB  |  371 lines

  1. NAME
  2.  
  3.     noiz -- a simple package for accumulating and dispensing
  4.         cryptographically-strong noise, using MD5 as 
  5.         a stirring function
  6.  
  7. ANTICOPYRIGHT
  8.  
  9.     Anticopyright (A) 1995 Henry Strickland <strick@yak.net>
  10.     This package is placed this package in the public domain.
  11.  
  12.     Because this package is free, there is no warranty 
  13.     for it whatsoever.  Caveat hacker.
  14.  
  15.     This is alpha-quality software.  It seemed to work for
  16.     me, but it may not do what I say it does.
  17.  
  18.     The MD5 implementation is by Colin Plumb (1993), 
  19.     and is also in the public domain.
  20.  
  21.  
  22. SYNOPSIS
  23.  
  24.     noizinit
  25.  
  26.         creates the file /etc/noiz
  27.  
  28.  
  29.     noizstir < noise-source
  30.  
  31.         stirs the noise-source into /etc/noiz
  32.  
  33.  
  34.     noizout < noise-source > output-noise
  35.  
  36.         produces 16 bytes of noise, for applications to use
  37.  
  38.  
  39.     noizspin > output-time
  40.  
  41.         prints a somewhat-random number, with several bits of
  42.         entropy.
  43.  
  44.  
  45. FILES
  46.  
  47.     /etc/noiz       a binary file containing 256 bytes of noise
  48.             state.   That's 2048 bits of entropy, assuming
  49.             it has been stirred with that much entropy.
  50.  
  51.  
  52.  
  53. DESCRIPTION
  54.  
  55.     noizinit        creates /etc/noiz and initializes it with bytes
  56.             0, 1, 2, 3, ... 255.
  57.  
  58.             It must be stirred several times with noizstir
  59.             before it is ready to be used by noizout.
  60.  
  61.  
  62.     noizspin        Set an alarm for 1 second.  Using an unsigned
  63.             long, count until the alarm is received, and
  64.             print the count, in ascii, as a decimal number,
  65.             followed by a newline.
  66.  
  67.  
  68.     noizstir        changes the noise ("stirs" it) in /etc/noiz,
  69.             based on prior contents of /etc/noiz, current
  70.             time, pid, ppid, and input bytes read from
  71.             standard input.
  72.  
  73.             The standard input may be empty (as in
  74.  
  75.                 noizstir < /dev/null
  76.  
  77.             ) or may be some system-generated noise (as in
  78.  
  79.                 ps uaxg | noizstir
  80.                 ls -li /tmp/ | noizstir
  81.                 netstat -s | noizstir
  82.  
  83.             ) or you may use the "noizspin" command which
  84.             was designed especially for this purpose:
  85.  
  86.                 noizspin | noizstir
  87.  
  88.     noizout         Produces 16 bytes of random noise, based on the
  89.             contents of /etc/noiz, current time, pid, ppid,
  90.             and input bytes read from standard input.   The
  91.             output is 16 raw binary bytes; if you want some
  92.             kind of ascii encoding, you must convert the
  93.             output.  Piping the output into "od -x" is
  94.             useful for debugging.
  95.  
  96.             Unlike noizstir, noizout does not change
  97.             /etc/noiz.  You may use it without empty
  98.             standard input, but it is better to feed it
  99.             some extra noise.  The noizspin command is good
  100.             for this:
  101.  
  102.                 noizspin | noizout 
  103.  
  104.             The bytes emitted from noizout do not reveal
  105.             the contents of /etc/noiz.  In fact, no command
  106.             does, so all users can share /etc/noiz.
  107.  
  108.             Because noizout always stirs current time, pid,
  109.             and ppid into its output, even this command,
  110.             repeated many times without running noizstir,
  111.             will generate fairly high-entropy random
  112.             output:
  113.  
  114.                 noizout < /dev/null
  115.                 
  116.  
  117.  
  118. DIAGNOSTICS
  119.  
  120.     All four programs print one line to stderr and exit with a
  121.     nonzero status if they cannot read or write /etc/noiz and they
  122.     need to.
  123.  
  124.     Otherwise the programs execute without writing to stdout, and
  125.     they exit with status zero.
  126.  
  127.  
  128.  
  129. RECOMMENDED INSTALLATION
  130.  
  131.     You should probably be root to do the "make install".  You may
  132.     use "make BIN=/etc install" to put the four binaries into the
  133.     /etc/ directory instead of /usr/local/bin/.
  134.  
  135.     /etc/noiz    owner root 
  136.             group kmem
  137.             mode 660     (not publically readable or writable)
  138.  
  139.     /usr/local/bin/noizinit
  140.             owner root
  141.             group kmem
  142.             mode 550    (no special permissions)
  143.                     (only execute at install time)
  144.  
  145.     /usr/local/bin/noizstir
  146.             owner root
  147.             group kmem
  148.             mode 2555    (setgid kmem)
  149.                     (anyone can execute)
  150.  
  151.     /usr/local/bin/noizout
  152.             owner root
  153.             group kmem
  154.             mode 2555    (setgid kmem)
  155.                     (anyone can execute)
  156.  
  157.     /usr/local/bin/noizspin
  158.             owner root
  159.             group kmem
  160.             mode 555    (no special permissions)
  161.                     (anyone can execute)
  162.  
  163.  
  164.     For your crontab:
  165.  
  166.         * * * * * /usr/local/bin/noizspin | /usr/local/bin/noizstir
  167.  
  168.         This will stir the /etc/noiz with a few bits of noise
  169.         per minute.
  170.  
  171.         You may put it in the crontab for root, or for daemon,
  172.         or users themselves may do it.
  173.  
  174.  
  175. EXAMPLE SESSION
  176.  
  177.         gwarn#
  178. initialize    gwarn#
  179. /etc/noiz    gwarn#
  180.         gwarn#
  181.         gwarn# /usr/local/bin/noizinit
  182. show initial    gwarn#
  183. contents     gwarn#
  184.         gwarn# od -x /etc/noiz
  185.         0000000  0001 0203 0405 0607 0809 0a0b 0c0d 0e0f
  186.         0000020  1011 1213 1415 1617 1819 1a1b 1c1d 1e1f
  187.         0000040  2021 2223 2425 2627 2829 2a2b 2c2d 2e2f
  188.         0000060  3031 3233 3435 3637 3839 3a3b 3c3d 3e3f
  189.         0000100  4041 4243 4445 4647 4849 4a4b 4c4d 4e4f
  190.         0000120  5051 5253 5455 5657 5859 5a5b 5c5d 5e5f
  191.         0000140  6061 6263 6465 6667 6869 6a6b 6c6d 6e6f
  192.         0000160  7071 7273 7475 7677 7879 7a7b 7c7d 7e7f
  193.         0000200  8081 8283 8485 8687 8889 8a8b 8c8d 8e8f
  194.         0000220  9091 9293 9495 9697 9899 9a9b 9c9d 9e9f
  195.         0000240  a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf
  196.         0000260  b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf
  197.         0000300  c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf
  198.         0000320  d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf
  199.         0000340  e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef
  200.         0000360  f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff
  201.         0000400
  202.         gwarn#
  203. spin some     gwarn#
  204. random numbers    gwarn#
  205. with noizspin    gwarn#
  206.         gwarn# noizspin
  207.         3082293
  208.         gwarn# noizspin
  209.         3025490
  210.         gwarn# noizspin
  211.         3077496
  212.         gwarn# noizspin
  213.         2985100
  214.         gwarn# noizspin
  215.         3047690
  216.         gwarn# noizspin
  217.         3082529
  218.         gwarn# noizspin
  219.         3063415
  220. /etc/noiz    gwarn#
  221. is unchanged    gwarn#
  222. until stirred    gwarn#
  223.         gwarn# od -x /etc/noiz
  224.         0000000  0001 0203 0405 0607 0809 0a0b 0c0d 0e0f
  225.         0000020  1011 1213 1415 1617 1819 1a1b 1c1d 1e1f
  226.         0000040  2021 2223 2425 2627 2829 2a2b 2c2d 2e2f
  227.         0000060  3031 3233 3435 3637 3839 3a3b 3c3d 3e3f
  228.         0000100  4041 4243 4445 4647 4849 4a4b 4c4d 4e4f
  229.         0000120  5051 5253 5455 5657 5859 5a5b 5c5d 5e5f
  230.         0000140  6061 6263 6465 6667 6869 6a6b 6c6d 6e6f
  231.         0000160  7071 7273 7475 7677 7879 7a7b 7c7d 7e7f
  232.         0000200  8081 8283 8485 8687 8889 8a8b 8c8d 8e8f
  233.         0000220  9091 9293 9495 9697 9899 9a9b 9c9d 9e9f
  234.         0000240  a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf
  235.         0000260  b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf
  236.         0000300  c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf
  237.         0000320  d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf
  238.         0000340  e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef
  239.         0000360  f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff
  240.         0000400
  241.         gwarn#
  242. so stir it,    gwarn#
  243. with some    gwarn#
  244. random input    gwarn#
  245.         gwarn# noizspin | noizstir
  246.         gwarn# od -x /etc/noiz
  247.         0000000  b695 3c73 7a0c 73e0 b37b 55f5 e6cf 2dec
  248.         0000020  1fa7 1544 890e a039 6a21 e2ec 4669 35ea
  249.         0000040  a9d8 1175 0dd9 9742 fd6a 1501 9039 1d73
  250.         0000060  2b0e 0864 93e8 63bf 4a63 3398 b63c ef77
  251.         0000100  2534 cd7e 0e79 fb56 5f53 bcc5 5b68 968d
  252.         0000120  910e bbf4 e222 03b2 13d8 908c e508 74a8
  253.         0000140  d056 fb99 ea7f dddb 9b2f c654 4cd0 1384
  254.         0000160  8899 3507 1dbb c367 43f1 9806 17e0 8780
  255.         0000200  95f7 af5a 7a78 92e0 126c 4f2d 3721 a5ee
  256.         0000220  4a12 f7c3 3186 febb 3ea8 f048 4fd1 41b8
  257.         0000240  812f 1d43 66a7 8e2d 7ca4 cddb 39c6 6b5f
  258.         0000260  9a8c 646b c511 304b eb9b b235 46da 5d2e
  259.         0000300  ec53 5816 c742 e92d 2468 8579 302d d932
  260.         0000320  2f45 03fb 4f2c ff10 b84d 15a5 8e46 8e84
  261.         0000340  ff12 0d68 26a3 10c2 87b5 4ebc 3b59 afa2
  262.         0000360  2bb2 bb64 371e 2f99 b108 c7d5 42eb 68c9
  263.         gwarn#
  264.         gwarn#
  265. now emit some     gwarn#
  266. 16-byte        gwarn#
  267. high-entropy    gwarn#
  268. output and     gwarn#
  269. display it    gwarn#
  270. with od -x    gwarn#
  271.         gwarn# noizspin | noizout | od -x
  272.         0000000  be7b 81f9 744c 2dca e36d a6c6 9394 7bf2
  273.         0000020
  274.         gwarn# noizspin | noizout | od -x
  275.         0000000  1cea b243 2b0e 55c3 7630 886c 3be3 d03f
  276.         0000020
  277.         gwarn# noizspin | noizout | od -x
  278.         0000000  6887 864d b4fc 40e6 7eb1 0d9e 6b47 f148
  279.         0000020
  280.         gwarn#
  281. demonstrate    gwarn#
  282. high-entropy    gwarn#
  283. output even    gwarn#
  284. without noise    gwarn#
  285. input and     gwarn#
  286. without     gwarn#
  287. stirring    gwarn#
  288.         gwarn#
  289.         gwarn# noizout < /dev/null | od -x
  290.         0000000  e54f 67a6 52ec 3d61 ddfd 1208 5f52 fead
  291.         0000020
  292.         gwarn# noizout < /dev/null | od -x
  293.         0000000  6472 5f9e fe81 fcab bca8 6d22 2400 0d0a
  294.         0000020
  295.         gwarn# noizout < /dev/null | od -x
  296.         0000000  2df4 9d73 ddc2 5aa4 10c6 59b8 e31c efda
  297.         0000020
  298.         gwarn# noizout < /dev/null | od -x
  299.         0000000  7f64 6671 957e b4aa ae4b 8fd8 7e90 601e
  300.         0000020
  301.         gwarn# noizout < /dev/null | od -x
  302.         0000000  2d8e 522c 700a 5367 d67f dae3 0977 0689
  303.         0000020
  304.  
  305.  
  306.  
  307. ALGORITHMS
  308.  
  309.    Let the syntax X[i..j] represent a subrange of an array X.
  310.    Let the syntax X[] represent the entire array X.
  311.  
  312.    Let the array Noiz[0..15][0..15] represent the 256 bytes of /etc/noiz
  313.    Let the array Noiz[r] represent the rth row (16 bytes) of Noiz
  314.  
  315.    Let the array Input[] represent bytes read from standard input
  316.  
  317.    Let the syntax  MD5( x, y, z... )  represent the MD5 hash of the 
  318.    concatenation of the arguments x, y, z...
  319.  
  320.  
  321.  
  322.    Algorithm of "noizstir":
  323.  
  324.     read Noiz[][] from /etc/noiz
  325.  
  326.     read Input[] from standard input
  327.  
  328.     In_hash[0..15] := MD5(  Noiz[][], 
  329.                 Input[],
  330.                 time, 
  331.                 pid,
  332.                 ppid,
  333.                 and some extra stuff from sloppy buffering
  334.                  );
  335.  
  336.     FOR r := 0 TO 15
  337.  
  338.         Out_hash[0..15] := MD5(    Noiz[r],
  339.                     In_hash[0..15],
  340.                     In_hash[0..r]
  341.                          );
  342.  
  343.         Noiz[r] := Noiz[r] BITWISE_XOR Out_hash[];
  344.  
  345.     NEXT r
  346.  
  347.     write Noiz[][] to /etc/noiz
  348.  
  349.  
  350.  
  351.    Algorithm of "noizout"
  352.  
  353.     read Noiz[][] from /etc/noiz
  354.  
  355.     read Input[] from standard input
  356.  
  357.     Out_hash[0..15] := MD5(  Noiz[][], 
  358.                  Input[],
  359.                  time, 
  360.                  pid,
  361.                  ppid,
  362.                  and some extra stuff from sloppy buffering
  363.                   );
  364.  
  365.       write Out_hash[] to standard output 
  366.  
  367.  
  368.  
  369.  
  370. END $Header: /mvp/fjord/strick/yaxen/noiz-0.5/RCS/noiz.doc,v 1.6 95/02/07 15:35:37 strick Exp Locker: strick $
  371.